package com.greensam.pixelengine.pojo.emuns;

import com.greensam.pixelengine.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Macro_Ray
 * @since 2025/7/08 17:22
 */
@Getter
@AllArgsConstructor
public enum ReviewStatusEnum {

    /**
     * 待审核
     */
    PENDING(0, "待审核"),

    /**
     * 审核通过
     */
    APPROVED(1, "审核通过"),

    /**
     * 审核未通过
     */
    REJECTED(2, "审核未通过");;

    private final Integer value;

    private final String description;

    /**
     * 根据 value 获取枚举
     */
    public static ReviewStatusEnum getEnumByValue(Integer value) {
        for (ReviewStatusEnum status : values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }
        throw new BusinessException(ErrorCodeEnum.DataNotExist, "Invalid review status value: " + value);
    }
}
